<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
	//session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shoppinghere</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Mạng xã hội mua bán siêu việt | ShoppingHere.com</title>
		<link rel="stylesheet" href="../css/reset.css" type="text/css" />
		<link rel="stylesheet" href="../css/common.css" type="text/css" />
		<link rel="stylesheet" href="../css/home.css" type="text/css" />
        <link rel="stylesheet" href="../css/seller.css"
		<script src="../scripts/jquery-1.5.2.min.js"></script>
		<script src="../scripts/common.js"></script>

        <script type="text/javascript" language="javascript">
			var xmlhttp;
			function createXMLHTTPRequest()
			{
				if(window.XMLHttpRequest)
				{
					return new XMLHttpRequest();
				}
				else if(window.ActiveXObject)
				{
					return new ActiveXObject("microsoft.XMLHTTP");
				}
				return null;
			}
			
			function loadBinhLuan(mask)
			{
				xmlhttp=createXMLHTTPRequest();
				xmlhttp.onreadystatechange=showBinhLuan;
				var serverUrl="../BUS/xlCommentBUS.php?mask="+mask;
				xmlhttp.open("get",serverUrl,"true");
				xmlhttp.send(null);
			}
			function indexClick(i,mask)
			{
				xmlhttp=createXMLHTTPRequest();
				xmlhttp.onreadystatechange=showBinhLuan;
				var serverUrl="../BUS/xlCommentBUS.php?mask="+mask+"&curPage="+i;
				xmlhttp.open("get",serverUrl,"true");
				xmlhttp.send(null);
			}

			function submitBinhLuan(mask)
			{
				var nd=document.getElementById("content-comment").value;
				if(nd=="")
				{
					alert("Chưa nhập bình luận của bạn");
					return;
				}
				xmlhttp=createXMLHTTPRequest();
				xmlhttp.onreadystatechange=showBinhLuan;
				var serverUrl="../BUS/xlCommentBUS.php?mask="+mask+"&nd="+nd;
				xmlhttp.open("get",serverUrl,"true");
				xmlhttp.send(null);
			}
			function showBinhLuan()
			{
				if(xmlhttp.readyState==4 && xmlhttp.status==200)
				{
					var result=xmlhttp.responseText;
					var div=document.getElementById("showBinhLuan");
					div.innerHTML=result;
				}
			}
			
		</script>
	</head>
	<body>
		<div id="page">
			<?php
				include_once("../webconfig.php");
				
				include_once("../DAO/DataHelper.php");
				include_once("../DAO/TaiKhoan_DAO.php");
				include_once("../DAO/DanhMucSanPham_DAO.php");
				include_once("../DAO/SanPham_DAO.php");
				include_once("../UserControl/header.php");
				include_once("../DAO/SuKienDTO.php");
				include_once("../DAO/SuKienDAO.php");
				
			?>
			<div id="content">
				<?php
					require("../UserControl/DanhMucLoaiSanPham.php");
				?>
				<div id="seller-details" class="block layout-2col-col2">
				<div class="title"><h4>Chi tiết sự kiện</h4></div>
				<div class="content">
                   
					<div class="seller-events">
                    	  <?php
						if(isset($_REQUEST['mask']))
						{
							$mask=$_REQUEST['mask'];
							$s=SuKienDAO::LayThongTinSuKien($mask);
							echo("<div class='col'><div class='image-col'>
								<img src='../temp/calendar.jpg' />								
							</div>
							<div class='details-col'>
								<p class='name'><b style='font-size:20px'>$s->sk_ten</b></p>
								<p class='start-date'><label>Ngày bắt đầu: </label><span>$s->sk_ngay_bat_dau</span></p>
								<p class='end-date'><label>Ngày kết thúc: </label><span>$s->sk_ngay_ket_thuc</span></p>
								<p class='details'><label>Mô tả chi tiết: </label>$s->sk_mo_ta</p>
							</div></div>
							
							<p class='seller-events-title'>Bình luận</p>");
                       
							echo("<script type='text/javascript' language='javascript'>
								loadBinhLuan($mask);
							</script>");
							echo("<div class='seller-events-item' id='showBinhLuan'>
	
							</div>");
						}
						else
						{
							header("Location: ../index.php");
						}
						
						
						?>
						
						
					</div>					
				</div>
			</div>
				
			</div>
			<?php
				require("../UserControl/footer.php");
			?>
		</div>
	</body>
</html>